function getCookie(cookieName) {
    return getCookieByCodeType(cookieName, "");
}

function getURLEncodeCookie(cookieName) {
    return getCookieByCodeType(cookieName, "URLENCODE");
}

function getBase64Cookie(cookieName) {
    return getCookieByCodeType(cookieName, "BASE64");
}

function getCookieByCodeType(cookieName, codeType) {
    var strCookie = document.cookie;
    var arrCookie = strCookie.split("; ");
    for (var i = 0; i < arrCookie.length; i++) {
        var arr = arrCookie[i].split("=");
        if(cookieName == arr[0]) {
            if(codeType == "BASE64") {
                return $.base64().decode(arr[1]);
            }else if(codeType == "URLENCODE"){
                return  decodeURIComponent(arr[1]);
            }else {
                return arr[1];
            }
        }
    }
    return "";
}
function getURLParameterString(name)
{
    var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if(r!=null) {
        return  unescape(r[2]);
    }
    return "";
}
//判断是否微信登陆
function isWeiXin() {
    var ua = window.navigator.userAgent.toLowerCase();
    console.log(ua);//mozilla/5.0 (iphone; cpu iphone os 9_1 like mac os x) applewebkit/601.1.46 (khtml, like gecko)version/9.0 mobile/13b143 safari/601.1
    if (ua.match(/MicroMessenger/i) == 'micromessenger') {
        return true;
    } else {
        return false;
    }
}

//微信JSAPI准备就绪的回调
function ready() {
    socialShare('#share', {sites: ['qzone', 'qq', 'weibo']});
}

//微信JSAPI准备失败的回调
function error() {
    socialShare('#share', {sites: ['qzone', 'qq', 'weibo']});
}